	
	window.onload=function(){
		
		var good=function(object1){
			object1.style.background="yellow";
			object1.innerHTML="赞+1";
		};
			
		var Good1=document.getElementById('good1');
		var Good2=document.getElementById('good2');
		var Good3=document.getElementById('good3');
		var Good4=document.getElementById('good4');
		var Good5=document.getElementById('good5');
		var Good6=document.getElementById('good6');
		var Good7=document.getElementById('good7');

		Good1.onclick=function(){
			good(Good1);
		}
		Good2.onclick=function(){
			good(Good2);
		}
		Good3.onclick=function(){
			good(Good3);
		}
		//Good4.onclick=function(){
		//	good(Good4);
		//}
		Good5.onclick=function(){
			good(Good5);
		}
		Good6.onclick=function(){
			good(Good6);
		}
		Good7.onclick=function(){
			good(Good7);
		}
		
		
		
		var day = new Date();
		var month=new String(" ");
		switch(day.getMonth()){
			case 0:var mon = month.concat("Jan");break;
			case 1:var mon = month.concat("Feb");break;
			case 2:var mon = month.concat("Mar");break;
			case 3:var mon = month.concat("Apr");break;
			case 4:var mon = month.concat("May");break;
			case 5:var mon = month.concat("Jun");break;
			case 6:var mon = month.concat("Jul");break;
			case 7:var mon = month.concat("Aug");break;
			case 8:var mon = month.concat("Sept");break;
			case 9:var mon = month.concat("Oct");break;
			case 10:var mon = month.concat("Nov");break;
			case 11:var mon = month.concat("Dec");break;	
		}
		document.getElementById('day').innerHTML="今日   "+mon+" "+day.getDate()+" "+day.getFullYear();
		
		var postData = {"submit":"主页"}	;
		$.post('http://118.89.25.120/home.php', postData, function (data) {
									var obj  = JSON.parse(data.trim());	
									console.log(obj);
									for(var i=0;i<3;i++){
										$('img').eq(i).attr("src",obj[i].picture_path);
										$('img').eq(i).width(630);
										$('img').eq(i).height(260);
										
									}
									for(var j=3;j<6;j++){
				 						$('img').eq(j).attr("src",obj[j].picture_path);
										$('img').eq(j).width(250);
										$('img').eq(j).height(150);
				 					}
									$("#bre").text(obj[0].food_name);
									$("#lun").text(obj[1].food_name);
									$("#din").text(obj[2].food_name);
									for(var k=0;k<3;k++){
										$(".text").eq(k).text(obj[k+3].share_content);
									}
									//$(".text").eq(2).text(obj[5].share_content);
									/*$("#bre").text(obj.food_name);	
									$('img').eq(0).attr("src",obj.picture_path);
									$('img').eq(0).width(630);
									$('img').eq(0).height(260);*/
						});
	}
	